/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package controllers;

import common.SimpleDate;
import db.RentItemDb;
import db.RentItemInterface;
import db.StorageItemDb;
import db.StorageItemInterface;
import java.util.ArrayList;
import models.Rent;
import models.StorageItem;

/**
 *
 * @author Dan
 */
public class RentItemController {

    private RentItemInterface rentItemDb = new RentItemDb();
    private StorageItemInterface stoItemDb = new StorageItemDb();

    
    public ArrayList<StorageItem> getAllStorageItem() {
        return stoItemDb.getAllRentabelItems();
    }
    
    public boolean addRent(ArrayList<StorageItem> items, int personid, int period) {
        Rent rentObj = new Rent(personid, SimpleDate.getDateString(), period, items);
        return this.rentItemDb.saveRentedIteams(rentObj);
    }
    
    public ArrayList<Rent> getRent(int stockId, int personId)
    {
        return rentItemDb.getRent(stockId, personId);
    }
}
